<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use Illuminate\Support\Facades\DB;

class carinfoController extends CommonController
{
    //
    public function index($id){
        $car=array();
        $car["car"] = DB::table("car")->join("carconfig","car_id","=","id")->where("id",$id)->first();

        $brand = Db::table("brand")->where("bid",$car["car"]->zc_brand_bid)->value("bname");
//        dd($brand);
        $car["car"]->brand = $brand;
        $info = DB::table("carinfo")->where("car_id",$id)->first();
        $bigimg = explode(",",$info->bigimg);
        $smallimg = explode(",",$info->smallimg);
//        dd($bigimg);
//        $car['info']->bigimg=$bigimg;
//        $car["info"]->smallimg=$smallimg;
        $car["bigimg"] = $bigimg;
        $car["smallimg"] = $smallimg;
//        dd($car);
        return view("home.carinfo",compact("car","info"));
    }
}
